
import argparse

def parse_arguments(invhnd):
    parser = argparse.ArgumentParser(description="invhnd-cli: Simple invhnd cli client.",
            formatter_class=argparse.ArgumentDefaultsHelpFormatter)

    parser.add_argument("-p",   "--plugins",    help="show plugins list",          action="store_true")
    parser.add_argument("-i",   "--items",      help="show plugin items by id"     )  
    parser.add_argument("-a",   "--action",     help="do plugin action (if id set)")
    parser.add_argument("-in",  "--input",      help="setup action input"          )
    parser.add_argument("-id",  "--id",         help="setup plugin id"             )
    
    args = parser.parse_args()

    if args.plugins: invhnd.show_plugins()
    elif not args.items is None: invhnd.show_plugin_items(args.items)
    elif not args.action is None: 
        if not args.id is None:
            invhnd.do_plugin_action(args.id, args.action, args.input)

